<template>
  <!-- 新建客户基本信息页面-->
  <div class="cust-base-info">
    <el-form
      ref="custFormBaseFormData"
      :model="custFormBaseFormData"
      :label-position="labelPosition"
      label-width="120px"
      :rules="rules"
    >
      <more-panel mode="1" title="身份证信息" v-if="$route.query.custflag!=''?false:true">
        <el-col :span="4" slot="fixed"
          ><div class="grid-content bg-purple">
            <div class="demo-image__placeholder">
              <div class="block" style="text-align:center;">
                <el-image v-if="!src" fit="scale-down" :src="require('@/assets/imgs/wjz.jpg')"  class="img">                                                 
                </el-image>
                <el-image v-else fit="scale-down" :src="src"  class="img">                                                
                </el-image>
              </div>
            </div></div
        ></el-col>
        <el-col :span="20" slot="fixed"
          ><div class="grid-content bg-purple">
            <div>
              <h3 class="u-title">
                {{ partName }}
              </h3>
              <el-row :gutter="6">
                <el-col
                  :span="8"
                  v-for="(item, index) in dataArr[0]"
                  :key="index"
                >
                  <el-col :span="10" class="u-name">{{ item.name }}：</el-col>
                  <el-col :span="14" class="u-value">{{ item.value }}</el-col>
                </el-col>
              </el-row>
            </div>
          </div>
        </el-col>
        <el-col :span="20" :offset="4">
          <el-row :gutter="6">
            <el-col :span="8" v-for="(item, index) in dataArr[1]" :key="index">
              <el-col :span="10" class="u-name">{{ item.name }}：</el-col>
              <el-col :span="14" class="u-value">{{ item.value }}</el-col>
            </el-col>
          </el-row>
        </el-col>
        <el-col :span="20" :offset="4">
          <el-row :gutter="6">
            <el-col :span="16" v-for="(item, index) in dataArr[2]" :key="index">
              <el-col :span="5" class="u-name">{{ item.name }}：</el-col>
              <el-col :span="19" class="u-value">{{ item.value }}</el-col>
            </el-col>
          </el-row>
        </el-col>
      </more-panel>
      <div class="m-contain">
        <el-row class="form-block">
          <el-col class="ne-title" :span="24">
            <p class="base-title title-left"><span>客户基本信息</span></p>
            <div>
              <el-row :gutter="3">
                <el-col :span="6">
                  <el-form-item label="营销责任地" required>
                    <el-input
                      placeholder="请输入内容"
                      v-model="$route.query.regionName"
                      class="input-with-select"
                      disabled
                    >
                    </el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="6">
                  <el-form-item label="客户经理" class="u-ipt" required prop="customerManager">
                    <dic-customer-select
                      :value="custFormBaseFormData.customerManager"
                      title="客户经理"
                      :withHeader="false"
                      ref="customerManagerRef"
                      size="70%"
                      lock-scroll
                      @inLoadAjax="customerManagerAjax"
                      @closeDialog="closeDialog"
                    >
                      <div class="m-title">
                        <span class="icon"></span> 员工列表
                      </div>
                      <el-form
                        ref="employeesListFormDataRef"
                        :model="employeesListFormData"
                        label-position="left"
                        label-width="80px"
                      >
                        <el-row :gutter="10">
                          <el-col :span="6">
                            <div class="grid-content bg-purple">
                              <el-form-item label="员工编码" class="u-ipt">
                                <el-input
                                  placeholder=""
                                  v-model="employeesListFormData.custCode"
                                  class="input-with-select"
                                >
                                </el-input>
                              </el-form-item>
                            </div>
                          </el-col>
                          <el-col :span="6">
                            <div class="grid-content bg-purple">
                              <el-form-item label="员工名称" class="u-ipt">
                                <el-input
                                  placeholder="请输入内容"
                                  v-model="employeesListFormData.custName"
                                  class="input-with-select"
                                >
                                </el-input>
                              </el-form-item>
                            </div>
                          </el-col>
                          <el-col :span="6">
                            <div class="grid-content bg-purple">
                              <el-form-item label="组织名称" class="u-ipt">
                                <el-input
                                  placeholder="请输入内容"
                                  v-model="employeesListFormData.orgName"
                                  class="input-with-select"
                                >
                                </el-input>
                              </el-form-item>
                            </div>
                          </el-col>
                          <el-col :span="4">
                            <el-button
                              type="primary"
                              size="small"
                              @click="employeesListQuery(1)"
                              >查询</el-button
                            >
                            <el-button
                              type="primary"
                              size="small"
                              @click="chooseHandel"
                              >选择</el-button
                            >
                          </el-col>
                        </el-row>
                      </el-form>
                      <el-table
                        ref="employeesListTableRef"
                        :data="employeesListTableData"
                        border
                        :header-cell-style="{
                          background: '#F2F2F2',
                          color: '#333',
                        }"
                        tooltip-effect="dark"
                        style="width: 100%"
                        @selection-change="handleSelectionChange"
                      >
                        <el-table-column type="selection" width="55">
                        </el-table-column>
                        <el-table-column
                          label="员工编码"
                          width="120"
                          prop="STAFF_CODE"
                        >
                        </el-table-column>
                        <el-table-column
                          prop="STAFF_NAME"
                          label="员工名称"
                          width="120"
                        >
                        </el-table-column>
                        <el-table-column
                          prop="ORG_NAME"
                          label="组织名称"
                          show-overflow-tooltip
                        >
                        </el-table-column>
                        <el-table-column
                          prop="DEPARTMENT_NAME"
                          label="部门名称"
                          show-overflow-tooltip
                        >
                        </el-table-column>
                        <el-table-column
                          prop="mobilePhone"
                          label="移动电话"
                          show-overflow-tooltip
                        >
                        </el-table-column>
                      </el-table>
                      <el-pagination
                        background
                        @size-change="employeesListTablePageHandleSizeChange"
                        @current-change="
                          employeesListTablePageHandleCurrentChange
                        "
                        :current-page="
                          parseInt(employeesListTablePage.pageIndex)
                        "
                        :page-size="parseInt(employeesListTablePage.pageSize)"
                        layout="total, prev, pager, next, jumper"
                        :total="parseInt(employeesListTablePage.rowCount)"
                        class="m-pagination"
                      >
                      </el-pagination>
                      <div class="m-title">
                        <span class="icon"></span> 已选择列表
                        <el-button
                          type="primary"
                          size="small"
                          @click="delManner"
                          >删除</el-button
                        >
                      </div>
                      <el-table
                        class="table-box"
                        ref="employeesSelectedListTableRef"
                        :data="employeesSelectedListTableData"
                        border
                        :header-cell-style="{
                          background: '#F2F2F2',
                          color: '#333',
                        }"
                        tooltip-effect="dark"
                        style="width: 100%"
                        @selection-change="
                          employeesSelectedListHandleSelectionChange
                        "
                      >
                        <el-table-column type="selection" width="55">
                        </el-table-column>
                        <el-table-column
                          label="员工编码"
                          width="120"
                          prop="STAFF_CODE"
                        >
                        </el-table-column>
                        <el-table-column
                          prop="STAFF_NAME"
                          label="员工名称"
                          width="120"
                        >
                        </el-table-column>
                        <el-table-column
                          prop="ORG_NAME"
                          label="组织名称"
                          show-overflow-tooltip
                        >
                        </el-table-column>
                        <el-table-column
                          prop="DEPARTMENT_NAME"
                          label="部门名称"
                          show-overflow-tooltip
                        >
                        </el-table-column>
                        <el-table-column
                          prop="mobilePhone"
                          label="移动电话"
                          show-overflow-tooltip
                        >
                        </el-table-column>
                      </el-table>
                    </dic-customer-select>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="16" class="line">
                  <load-city
                    :cityName="cityName"
                    :address="address"
                    @func="getAddress"
                  ></load-city>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="16">
                  <el-form-item
                    label="详细地址"
                    class="u-ipt xxAdress"
                    prop="detailAddress"
                    required
                  >
                    <el-input
                      placeholder="请输入内容"
                      v-model="custFormBaseFormData.detailAddress"
                      class="input-with-select"
                    >
                    </el-input>
                  </el-form-item>
                </el-col>
              </el-row>
            </div>
          </el-col>
        </el-row>
        <el-row :gutter="3" class="m-contain">
          <more-panel mode="1" title="客户联系人信息">
            <!-- 添加更多弹窗 -->
            <el-button
              @click="visible"
              style="float: right"
              slot="more-button"
              type="primary"
              >添加更多</el-button
            >
            <el-col :span="6" slot="fixed">
              <el-form-item
                label="联系人名称"
                class="u-ipt"
                required
                prop="contactName"
              >
                <el-input
                  placeholder="请输入内容"
                  v-model="custFormBaseFormData.contactName"
                  class="input-with-select"
                >
                </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6"  v-if="phoneBool" slot="fixed">
              <el-form-item
                label="移动电话"
                class="u-ipt"
                required
                prop="mobilePhone"
              >
                <el-input
                  placeholder="请输入内容"
                  v-model="custFormBaseFormData.mobilePhone"
                  class="input-with-select"
                >
                </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6"  v-else slot="fixed">
              <el-form-item
                label="移动电话"
                class="u-ipt"
                required
                prop="mobilePhone1"
              >
                <el-input
                  placeholder="请输入内容"
                  v-model="custFormBaseFormData.mobilePhone1"
                  class="input-with-select"
                >
                </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6" slot="fixed">
              <el-form-item label="Email" class="u-ipt" prop="Email">
                <el-input
                  placeholder="请输入内容"
                  v-model="custFormBaseFormData.Email"
                  class="input-with-select"
                >
                </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6"></el-col>
            <el-col :span="6">
              <el-form-item label="证件类型" class="u-ipt" prop="idType">
                <el-select
                  v-model="custFormBaseFormData.idType"
                  placeholder="请选择"
                  class="m-select"
                  @change="changeType"
                >
                  <el-option
                    v-for="item in selectInfo[5]['val']"
                    :key="item.code"
                    :label="item.name"
                    :value="item.code"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="证件号码" class="u-ipt" prop="idNumber">
                <el-input
                  placeholder="请输入内容"
                  v-model="custFormBaseFormData.idNumber"
                  class="input-with-select"
                >
                </el-input>
              </el-form-item>
            </el-col>
            <!-- <el-col :span="6" v-else>
              <el-form-item label="证件号码" class="u-ipt">
                <el-input
                  placeholder="请输入内容"
                  v-model="custFormBaseFormData.idNumber"
                  class="input-with-select"
                >
                </el-input>
              </el-form-item>
            </el-col> -->
            <el-col :span="6">
              <el-form-item
                label="通信地址"
                class="u-ipt"
                prop="communicationAddress"
              >
                <el-input
                  placeholder="请输入内容"
                  v-model="custFormBaseFormData.communicationAddress"
                  class="input-with-select"
                  maxlength="80"
                >
                </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item
                label="通信邮编"
                class="u-ipt"
                prop="communicationZipCode"
              >
                <el-input
                  placeholder="请输入内容"
                  v-model="custFormBaseFormData.communicationZipCode"
                  class="input-with-select"
                  maxlength="6"
                >
                </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="办公电话" class="u-ipt" prop="officePhone">
                <el-input
                  placeholder="请输入内容"
                  v-model="custFormBaseFormData.officePhone"
                  class="input-with-select"
                >
                </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="传真" class="u-ipt" prop="communicationFix">
                <el-input
                  placeholder="请输入内容"
                  v-model="custFormBaseFormData.communicationFix"
                  class="input-with-select"
                >
                </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="是否首选联系人" class="u-ipt">
                <el-select
                  v-model="custFormBaseFormData.preferredContactValue"
                  placeholder="请选择"
                  class="m-select"
                  disabled
                >
                  <el-option
                    v-for="item in preferredContactArr"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  >
                  </el-option>
                </el-select>
                <!-- <el-radio-group
                  v-model="custFormBaseFormData.preferredContactValue"
                >
                  <el-radio-button
                    class="radioBtn"
                    v-for="item in preferredContactArr"
                    :key="item.value"
                    :label="item.label"
                    >{{ item.label }}</el-radio-button
                  >
                </el-radio-group> -->
              </el-form-item>
            </el-col>
          </more-panel>
        </el-row>
        <el-dialog
          ref="addcustmer"
          title="添加更多联系人"
          width="80%"
          :visible.sync="outerVisible"
          :close-on-click-modal="false"
          :withHeader="false"
          class="m-dialog"
          @close="closeShow"
        >
          <el-table
            ref="contactsArr"
            border
            :header-cell-style="{
              background: '#F2F2F2',
              color: '#333',
            }"
            :data="contactsArr.slice((custContactTablePage.pageIndex - 1) * custContactTablePage.pageSize,
            custContactTablePage.pageIndex * custContactTablePage.pageSize)"
            tooltip-effect="dark"
            style="width: 100%"
          >
            <el-table-column
              label="联系人姓名"
              prop="contactName"
              show-overflow-tooltip
              align="center"
            >
            </el-table-column>
            <el-table-column
              prop="mobilePhone"
              label="移动电话"
              show-overflow-tooltip
              align="center"
            >
            </el-table-column>
            <el-table-column
              prop="officePhone"
              label="办公电话"
              show-overflow-tooltip
              align="center"
            >
            </el-table-column>
            <el-table-column
              prop="contactCertType"
              label="证件类型"
              show-overflow-tooltip
              align="center"
            >
            </el-table-column>
            <el-table-column
              prop="contactCertNum"
              label="证件号码"
              show-overflow-tooltip
              align="center"
            >
            </el-table-column>
            <el-table-column
              prop="eMail"
              label="Email"
              show-overflow-tooltip
              align="center"
            >
            </el-table-column>
            <el-table-column
              prop="contactAddr"
              label="通信地址"
              show-overflow-tooltip
              align="center"
            >
            </el-table-column>
            <el-table-column
              prop="postcode"
              label="通信邮编"
              show-overflow-tooltip
              align="center"
            >
            </el-table-column>
            <el-table-column
              prop="fax"
              label="传真"
              show-overflow-tooltip
              align="center"
            >
            </el-table-column>
            <el-table-column
              prop="headFlag"
              label="是否是首选联系人"
              show-overflow-tooltip
              align="center"
            >
            </el-table-column>
            <el-table-column label="操作" align="center">
              <!-- <el-button type="text" size="small">修改</el-button>
              <el-button type="text" size="small">删除</el-button> -->
              <template slot-scope="scope">
                <el-button
                  class="editBtn"
                  @click="handleClick(scope.row,scope.$index)"
                  type="text"
                  size="small"
                  >修改</el-button
                >
                <el-button class="delBtn" type="text" size="small" @click="delClick(scope.$index,contactsArr)"
                  >删除</el-button
                >
              </template>
            </el-table-column>
          </el-table>
          <el-pagination
            background
            @current-change="custContactHandleCurrentChange"
            :current-page="parseInt(custContactTablePage.pageIndex)"
            :page-size="parseInt(custContactTablePage.pageSize)"
            layout="total, prev, pager, next, jumper"
            :total="contactsArr.length"
            class="m-pagination"
          >
          </el-pagination>
          <el-form label-width="100px" ref="custContactFormData" :model="custContactFormData" :rules="contactRules">
            <el-row :gutter="3" class="m-contain-l">
              <el-col :span="6">
                <el-form-item
                  label="联系人名称"
                  class="u-ipt"
                  prop="contactName"
                  required
                >
                  <el-input
                    placeholder="请输入内容"
                    v-model="custContactFormData.contactName"
                    class="input-with-select"
                  >
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="移动电话" class="u-ipt" prop="mobilePhone" required>
                  <el-input
                    placeholder="请输入内容"
                    v-model="custContactFormData.mobilePhone"
                    class="input-with-select"
                  >
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="办公电话" class="u-ipt" prop="officePhone">
                  <el-input
                    placeholder="请输入内容"
                    v-model="custContactFormData.officePhone"
                    class="input-with-select"
                  >
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="证件类型" class="u-ipt" prop="contactCertType">
                  <el-select
                    v-model="custContactFormData.contactCertType"
                    placeholder="请选择"
                    class="m-select"
                  >
                    <el-option
                      v-for="item in selectInfo[5]['val']"
                      :key="item.code"
                      :label="item.name"
                      :value="item.code"
                    >
                    </el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="证件号码" class="u-ipt" prop="contactCertNum">
                  <el-input
                    placeholder="请输入内容"
                    v-model="custContactFormData.contactCertNum"
                    class="input-with-select"
                  >
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="Email" class="u-ipt" prop="eMail">
                  <el-input
                    placeholder="请输入内容"
                    v-model="custContactFormData.eMail"
                    class="input-with-select"
                  >
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item
                  label="通信地址"
                  class="u-ipt"
                  prop="contactAddr"
                >
                  <el-input
                    placeholder="请输入内容"
                    v-model="custContactFormData.contactAddr"
                    class="input-with-select"
                    maxlength="80"
                  >
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item
                  label="通信邮编"
                  class="u-ipt"
                  prop="postcode"
                >
                  <el-input
                    placeholder="请输入内容"
                    v-model="custContactFormData.postcode"
                    class="input-with-select"
                    maxlength="6"
                  >
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item
                  label="传真"
                  class="u-ipt"
                  prop="fax"
                >
                  <el-input
                    placeholder="请输入内容"
                    v-model="custContactFormData.fax"
                    class="input-with-select"
                  >
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="是否首选联系人" class="u-ipt">
                  <el-select
                    v-model="serviceFlag"
                    placeholder="请选择"
                    class="m-select"
                    disabled
                  >
                    <el-option
                      v-for="item in preferredContactArr"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    >
                    </el-option>
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>
          </el-form>
          <div style="text-align: center;padding-bottom:10px">
            <el-button type="primary" class="comit_Btn" @click="custContactSave" plain>保存</el-button>
            <el-button type="primary" class="cancel_Btn" @click="closeShow" plain>取消</el-button>
          </div>
        </el-dialog>
        <el-row :gutter="3" class="m-contain">
          <el-row :gutter="3">
            <MorePanel
              mode="1"
              ref="MorePanel"
              title="纳税人信息"
              :nsrIsShow="nsrIsShow"
              @nsrShow="changeShow"
            >
              <el-row slot="fixed">
                <el-col :span="6">
                  <el-form-item
                    label="是否一般纳税人"
                    class="u-ipt"
                    required
                    prop="generalTaxpayer"
                  >
                    <!-- <el-select
                      @change="nsrSelectChange"
                      v-model="custFormBaseFormData.generalTaxpayer"
                      placeholder="请选择"
                      class="m-select"
                    >
                      <el-option
                        v-for="item in generalTaxpayerArr"
                        :key="item.value"
                        :label="item.label"
                        :value="item.value"
                      >
                      </el-option>
                    </el-select> -->
                    <el-radio-group
                      v-model="custFormBaseFormData.generalTaxpayer"
                      @change="nsrSelectChange"
                    >
                      <el-radio-button
                        class="radioBtn"
                        v-for="item in generalTaxpayerArr"
                        :key="item.value"
                        :label="item.label"
                        >{{ item.label }}</el-radio-button
                      >
                    </el-radio-group>
                  </el-form-item>
                </el-col>
                <el-col :span="6">
                <el-form-item label="纳税客户名称" class="u-ipt" required>
                  <el-input
                    placeholder="请输入内容"
                    disabled
                    v-model="partName"
                    class="input-with-select"
                  >
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item
                  label="税务登记号"
                  class="u-ipt"
                  :required="
                    custFormBaseFormData.generalTaxpayer == '是' ? true : false
                  "
                  prop="registrationNumber"
                >
                  <el-input
                    placeholder="请输入内容"
                    v-model="custFormBaseFormData.registrationNumber"
                    class="input-with-select"
                    @blur="registration"
                  >
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item
                  label="税务登记号所属省份"
                  class="u-ipt"
                  prop="provincesTax"
                >
                  <el-select
                    v-model="custFormBaseFormData.provincesTax"
                    placeholder="请选择"
                    class="m-select"
                    :disabled= "nsrDisabeld"
                  >
                    <el-option
                      v-for="item in selectInfo[6]['val']"
                      :key="item.code"
                      :label="item.name"
                      :value="item.code"
                    >
                    </el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              </el-row>
              <el-col :span="6">
                <el-form-item
                  label="税务登记联系电话"
                  class="u-ipt"
                  :required="
                    custFormBaseFormData.generalTaxpayer == '是' ? true : false
                  "
                  prop="registrationContactNumber"
                >
                  <el-input
                    placeholder="请输入内容"
                    v-model="custFormBaseFormData.registrationContactNumber"
                    class="input-with-select"
                  >
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item
                  label="税务开户银行名称"
                  class="u-ipt"
                  :required="
                    custFormBaseFormData.generalTaxpayer == '是' ? true : false
                  "
                  prop="taxBankName"
                >
                  <el-input
                    placeholder="请输入内容"
                    v-model="custFormBaseFormData.taxBankName"
                    class="input-with-select"
                  >
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item
                  label="税务开户银行帐号"
                  class="u-ipt"
                  :required="
                    custFormBaseFormData.generalTaxpayer == '是' ? true : false
                  "
                  prop="taxBankAccount"
                >
                  <el-input
                    placeholder="请输入内容"
                    v-model="custFormBaseFormData.taxBankAccount"
                    class="input-with-select"
                  >
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item
                  label="是否开增值税发票"
                  class="u-ipt"
                  :required="
                    custFormBaseFormData.generalTaxpayer == '是' ? true : false
                  "
                  prop="whetherValueAddedInvoice"
                >
                  <el-select
                    v-model="custFormBaseFormData.whetherValueAddedInvoice"
                    placeholder="请选择"
                    class="m-select"
                  >
                    <el-option
                      v-for="item in whetherValueAddedInvoiceArr"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    >
                    </el-option>
                  </el-select>
                  <!-- <el-radio-group v-model="custFormBaseFormData.whetherValueAddedInvoice">
                      <el-radio-button
                        class="radioBtn"
                        v-for="item in whetherValueAddedInvoiceArr"
                        :key="item.value"
                        :label="item.label"
                        >{{ item.label }}</el-radio-button
                      >
                  </el-radio-group> -->
                </el-form-item>
              </el-col>
              <el-col :span="6" class="zhanwei"> </el-col>
              <el-col :span="12">
                <el-form-item
                  label="税务登记地址"
                  class="u-ipt"
                  :required="
                    custFormBaseFormData.generalTaxpayer == '是' ? true : false
                  "
                  prop="taxRegisteredAddress"
                >
                  <el-input
                    placeholder="请输入内容"
                    v-model="custFormBaseFormData.taxRegisteredAddress"
                    class="input-with-select"
                  >
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item
                  label="提交税务审核日期"
                  class="u-ipt"
                  :required="
                    custFormBaseFormData.generalTaxpayer == '是' ? true : false
                  "
                  prop="submissionTaxAuditData"
                >
                  <el-date-picker
                    v-model="custFormBaseFormData.submissionTaxAuditData"
                    type="date"
                    placeholder="选择日期"
                    format="yyyy 年 MM 月 dd 日"
                    value-format="yyyy-MM-dd"
                    :picker-options="taxStartDate"
                  >
                    >
                  </el-date-picker>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item
                  label="审核状态"
                  class="u-ipt"
                  :required="
                    custFormBaseFormData.generalTaxpayer == '是' ? true : false
                  "
                  prop="reviewStatus"
                >
                  <el-select
                    v-model="custFormBaseFormData.reviewStatus"
                    placeholder="请选择"
                    class="m-select"
                  >
                    <el-option
                      v-for="item in reviewStatusArr"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    >
                    </el-option>
                  </el-select>
                  <!-- <el-radio-group v-model="custFormBaseFormData.reviewStatus">
                      <el-radio-button
                        class="radioBtn"
                        v-for="item in reviewStatusArr"
                        :key="item.value"
                        :label="item.label"
                        >{{ item.label }}</el-radio-button
                      >
                  </el-radio-group> -->
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item
                  label="税务审核通过日期"
                  class="u-ipt"
                  prop="taxApprovalDate"
                >
                  <el-date-picker
                    v-model="custFormBaseFormData.taxApprovalDate"
                    type="date"
                    placeholder="选择日期"
                    format="yyyy 年 MM 月 dd 日"
                    value-format="yyyy-MM-dd"
                    :picker-options="taxStartDate"
                  >
                    >
                  </el-date-picker>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item
                  label="通知短信手机号"
                  class="u-ipt"
                  prop="phoneNumberNotification"
                >
                  <el-input
                    placeholder="请输入内容"
                    v-model="custFormBaseFormData.phoneNumberNotification"
                    class="input-with-select"
                    maxlength="11"
                  >
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item
                  label="通知邮箱号"
                  class="u-ipt"
                  prop="notificationEmailNbr"
                >
                  <el-input
                    placeholder="请输入内容"
                    v-model="custFormBaseFormData.notificationEmailNbr"
                    class="input-with-select"
                  >
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="取票方式" class="u-ipt" prop="ticketsWay">
                  <el-select
                    v-model="custFormBaseFormData.ticketsWay"
                    placeholder="请选择"
                    class="m-select"
                  >
                    <el-option
                      v-for="item in ticketsWayArr"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    >
                    </el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="6" v-if="nsrinShow">
                <el-form-item label="邮寄地址" class="u-ipt" prop="mailAddress">
                  <el-input
                    placeholder="请输入内容"
                    v-model="custFormBaseFormData.mailAddress"
                    class="input-with-select"
                  >
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6" v-if="nsrinShow">
                <el-form-item label="邮编" class="u-ipt" prop="zipCode">
                  <el-input
                    placeholder="请输入内容"
                    v-model="custFormBaseFormData.zipCode"
                    class="input-with-select"
                  >
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6" v-if="nsrinShow">
                <el-form-item label="开票点" class="u-ipt" prop="ticketsWay">
                  <el-input
                    placeholder="请输入内容"
                    v-model="custFormBaseFormData.makeOutInvoicePlace"
                    class="input-with-select"
                  >
                  </el-input>
                </el-form-item>
              </el-col>
            </MorePanel>
          </el-row>
        </el-row>
        <!-- 其他补充信息 -->
        <el-row :gutter="3" class="other-info">
          <more-panel mode="1" title="其他补充信息">
            <el-col :span="6">
              <el-form-item
                label="客户性质"
                class="u-ipt"
                prop="generalTaxpayer"
              >
                <el-select
                  v-model="custFormBaseFormData.custPropertyValue"
                  placeholder="请选择"
                  class="m-select"
                >
                  <el-option
                    v-for="item in selectInfo[1]['val']"
                    :key="item.code"
                    :label="item.name"
                    :value="item.code"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item
                label="售后服务等级"
                class="u-ipt"
                prop="afterSalesServiceLevel"
              >
                <el-select
                  v-model="custFormBaseFormData.afterSalesServiceLevel"
                  placeholder="请选择"
                  class="m-select"
                >
                  <el-option
                    v-for="item in selectInfo[2]['val']"
                    :key="item.code"
                    :label="item.name"
                    :value="item.code"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item
                label=" 客户服务等级"
                class="u-ipt"
                prop="custSalesServiceLevel"
              >
                <el-select
                  v-model="custFormBaseFormData.custSalesServiceLevel"
                  placeholder="请选择"
                  class="m-select"
                >
                  <el-option
                    v-for="item in selectInfo[3]['val']"
                    :key="item.code"
                    :label="item.name"
                    :value="item.code"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item
                label="省行业经理"
                class="u-ipt"
                prop="proIndustryManagerValue"
              >
                <dic-customer-select
                  :value="chooseProManagerPage.STAFF_NAME"
                  title="省行业经理"
                  :withHeader="false"
                  ref="dicCustomerSelect"
                  size="70%"
                  @inLoadAjax="proIndustryManagerAjax"
                >
                  <el-form
                    ref="proIndustryManagerFormRef"
                    :model="proIndustryManagerFormData"
                    :label-position="labelPosition"
                    label-width="80px"
                  >
                    <el-row :gutter="10">
                      <el-col :span="5">
                        <el-form-item
                          label="员工编码"
                          class="u-ipt"
                          prop="custCode"
                        >
                          <el-input
                            placeholder=""
                            v-model="proIndustryManagerFormData.custCode"
                            class="input-with-select"
                          >
                          </el-input>
                        </el-form-item>
                      </el-col>
                      <el-col :span="5">
                        <el-form-item
                          label="员工姓名"
                          class="u-ipt"
                          prop="custName"
                        >
                          <el-input
                            placeholder=""
                            v-model="proIndustryManagerFormData.custName"
                            class="input-with-select"
                          >
                          </el-input>
                        </el-form-item>
                      </el-col>
                      <el-col :span="5">
                        <el-form-item
                          label="组织名称"
                          class="u-ipt"
                          prop="orgName"
                        >
                          <el-input
                            placeholder=""
                            v-model="proIndustryManagerFormData.orgName"
                            class="input-with-select"
                          >
                          </el-input>
                        </el-form-item>
                      </el-col>
                      <el-col :span="5">
                        <el-form-item
                          label="手机号码"
                          class="u-ipt"
                          prop="mobileNumber"
                        >
                          <el-input
                            placeholder=""
                            v-model="proIndustryManagerFormData.mobileNumber"
                            class="input-with-select"
                          >
                          </el-input>
                        </el-form-item>
                      </el-col>
                      <el-col :span="4">
                        <el-button
                          type="primary"
                          size="small"
                          @click="employeesListQuery(2)"
                          >查询</el-button
                        >
                      </el-col>
                    </el-row>
                    <el-table
                      v-if="showManerP"
                      :data="proIndustryManagerTable"
                      ref="localNetworkManageRef"
                      border
                      :header-cell-style="{
                        background: '#F2F2F2',
                        color: '#333',
                      }"
                      @row-click="proIndustryManagerDialogRow"
                      class="proIndustryManager-table"
                    >
                      <el-table-column property="STAFF_CODE" label="员工编码">
                      </el-table-column>
                      <el-table-column property="STAFF_NAME" label="员工名称">
                      </el-table-column>
                      <el-table-column property="ORG_NAME" label="组织名称">
                      </el-table-column>
                      <el-table-column
                        property="DEPARTMENT_NAME"
                        label="部门名称"
                      >
                      </el-table-column>
                      <el-table-column property="telNumber" label="移动电话">
                      </el-table-column>
                    </el-table>
                    <el-pagination
                      v-if="showManerP"
                      background
                      @size-change="handleSizeChange"
                      @current-change="proHandleCurrentChange"
                      :current-page="parseInt(proIndustryManagerPage.pageIndex)"
                      :page-size="parseInt(proIndustryManagerPage.pageSize)"
                      layout="total, prev, pager, next, jumper"
                      :total="parseInt(proIndustryManagerPage.rowCount)"
                      class="m-pagination"
                    >
                    </el-pagination>
                  </el-form>
                  <div class="checkMan" v-if="!showManerP">请输入查询条件</div>
                </dic-customer-select>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <contry-or-provice
                :cityName="contryName"
                :address="contryAddress"
                :required="false"
                @func="getcontry"
              ></contry-or-provice>
            </el-col>
            <el-col :span="6">
              <el-form-item
                label="企业员工数"
                class="u-ipt"
                prop="employeesNumber"
              >
                <el-input
                  placeholder="请输入内容"
                  v-model="custFormBaseFormData.employeesNumber"
                  class="input-with-select"
                  oninput="value=value.replace(/[^\d]/g,'')"
                >
                </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item
                label="本地行业经理"
                class="u-ipt"
                prop="proIndustryManagerValue"
              >
                <dic-customer-select
                  :value="chooseLocalManagerPage.STAFF_NAME"
                  title="本地行业经理"
                  :withHeader="false"
                  ref="localNetworkManager"
                  size="70%"
                  @inLoadAjax="localNetworkManagerAjax"
                >
                  <el-form
                    ref="proIndustryManagerFormRef"
                    :model="localNetworkManagerFormData"
                    :label-position="localNetworkManagerFormLabelPosition"
                    label-width="80px"
                  >
                    <el-row :gutter="10">
                      <el-col :span="5">
                        <el-form-item
                          label="员工编码"
                          class="u-ipt"
                          prop="custCode"
                        >
                          <el-input
                            placeholder=""
                            v-model="localNetworkManagerFormData.custCode"
                            class="input-with-select"
                          >
                          </el-input>
                        </el-form-item>
                      </el-col>
                      <el-col :span="5">
                        <el-form-item
                          label="员工姓名"
                          class="u-ipt"
                          prop="custName"
                        >
                          <el-input
                            placeholder=""
                            v-model="localNetworkManagerFormData.custName"
                            class="input-with-select"
                          >
                          </el-input>
                        </el-form-item>
                      </el-col>
                      <el-col :span="5">
                        <el-form-item
                          label="组织名称"
                          class="u-ipt"
                          prop="orgName"
                        >
                          <el-input
                            placeholder=""
                            v-model="localNetworkManagerFormData.orgName"
                            class="input-with-select"
                          >
                          </el-input>
                        </el-form-item>
                      </el-col>
                      <el-col :span="5">
                        <el-form-item
                          label="手机号码"
                          class="u-ipt"
                          prop="mobileNumber"
                        >
                          <el-input
                            placeholder=""
                            v-model="localNetworkManagerFormData.mobileNumber"
                            class="input-with-select"
                          >
                          </el-input>
                        </el-form-item>
                      </el-col>
                      <el-col :span="4">
                        <el-button
                          type="primary"
                          size="small"
                          @click="employeesListQuery(3)"
                          >查询</el-button
                        >
                      </el-col>
                    </el-row>
                    <el-table
                      v-if="showManerL"
                      :data="localNetworkManageTable"
                      ref="localIndustryManager"
                      border
                      :header-cell-style="{
                        background: '#F2F2F2',
                        color: '#333',
                      }"
                      @row-click="localNetworkManagerDialogRow"
                      class="proIndustryManager-table"
                    >
                      <el-table-column property="STAFF_CODE" label="员工编码">
                      </el-table-column>
                      <el-table-column property="STAFF_NAME" label="员工名称">
                      </el-table-column>
                      <el-table-column property="ORG_NAME" label="组织名称">
                      </el-table-column>
                      <el-table-column
                        property="DEPARTMENT_NAME"
                        label="部门名称"
                      >
                      </el-table-column>
                      <el-table-column property="telNumber" label="移动电话">
                      </el-table-column>
                    </el-table>
                    <el-pagination
                      v-if="showManerL"
                      background
                      @size-change="handleSizeChange"
                      @current-change="handleCurrentChange"
                      :current-page="
                        parseInt(LocalIndustryManagerPage.pageIndex)
                      "
                      :page-size="parseInt(LocalIndustryManagerPage.pageSize)"
                      layout="total, prev, pager, next, jumper"
                      :total="parseInt(LocalIndustryManagerPage.rowCount)"
                      class="m-pagination"
                    >
                    </el-pagination>
                  </el-form>
                  <div class="checkMan" v-if="!showManerL">请输入查询条件</div>
                </dic-customer-select>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item
                label="客户类别"
                class="u-ipt"
                prop="proIndustryManagerValue"
              >
                <el-select
                  v-model="custFormBaseFormData.custKind"
                  placeholder="请选择"
                  class="m-select"
                >
                  <el-option
                    v-for="item in selectInfo[0]['val']"
                    :key="item.code"
                    :label="item.name"
                    :value="item.code"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="经办人名称" class="u-ipt" prop="agentName">
                <el-input
                  placeholder="请输入内容"
                  v-model="custFormBaseFormData.agentName"
                  class="input-with-select"
                >
                </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="证件类型" class="u-ipt" prop="agentIdType">
                <el-select
                  v-model="custFormBaseFormData.agentIdType"
                  placeholder="请选择"
                  class="m-select"
                >
                  <el-option
                    v-for="item in selectInfo[4]['val']"
                    :key="item.code"
                    :label="item.name"
                    :value="item.code"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="证件号码" class="u-ipt" prop="agentCardNumber">
                <el-input
                  placeholder="请输入内容"
                  v-model="custFormBaseFormData.agentCardNumber"
                  class="input-with-select"
                >
                </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6"></el-col>
            <el-col :span="12">
              <el-form-item label="证件地址" class="u-ipt" prop="agentCardAddress">
                <el-input
                  placeholder="请输入内容"
                  v-model="custFormBaseFormData.agentCardAddress"
                  class="input-with-select"
                >
                </el-input>
              </el-form-item>
            </el-col>
          </more-panel>
        </el-row>
      </div>
      <div class="button-sx-f clearfix">
        <el-button type="primary" class="comit_Btn" plain @click="comitBtn()"
          >提交</el-button
        >
        <el-button type="primary" class="cancel_Btn" plain @click="cancelBtn()"
          >取消</el-button
        >
      </div>
    </el-form>
  </div>
</template>

<script>
import MorePanel from "@/components/public/MorePanel/MorePanelCust";
import DicCustomerSelect from "@/components/customer/form/DicCustomerSelect";
import CustomerInfoManageServer from "@/api/customer/CustomerInfoManageServer";
import loadCity from "@/components/public/loadCity";
import { mapState } from "vuex";
import ContryOrProvice from "@/components/public/loadCity/ContryOrProvice";
import validRules from "@/views/customer/valide/validRules.js";

export default {
  name: "modifyBasicInfo",
  data() {
    return {
      src: "https://cube.elemecdn.com/6/94/4d3ea53c084bad6931a56d5158a48jpeg.jpeg",
      dataArr: [
        [
          {
            name: "统一社会信用代码",
            value: "",
            flag: "0",
          },
          {
            name: "证件类型",
            value: "",
            flag: "0",
          },
          {
            name: "证件号码",
            value: "",
            flag: "0",
          },
          {
            name: "身份证类型",
            value: "",
            flag: "0",
          },
          {
            name: "身份证编码",
            value: "",
            flag: "0",
          },
          {
            name: "身份证有效期",
            value: "",
            flag: "0",
          },
          {
            name: "客户简称",
            value: "",
            flag: "0",
          },
          {
            name: "机构类型",
            value: "",
            flag: "0",
          },
          {
            name: "行业类型",
            value: "",
            flag: "1",
          },
        ],
        [
          {
            name: "登记管理部门名称",
            value: "",
            flag: "0",
          },
          {
            name: "经济行业类型",
            value: "",
            flag: "0",
          },
          {
            name: "经济类型",
            value: "",
            flag: "0",
          },
          {
            name: "法定代表人姓名",
            value: "",
            flag: "0",
          },
          {
            name: "注册资本",
            value: "",
            flag: "0",
          },
          {
            name: "成立日期",
            value: "",
            flag: "0",
          },
          {
            name: "发照日期",
            value: "",
            flag: "0",
          },
          {
            name: "经营状态",
            value: "",
            flag: "0",
          },
          {
            name: "发证机关",
            value: "",
            flag: "0",
          },
          {
            name: "生产经营地址",
            value: "",
            flag: "0",
          },
          {
            name: "注册地址",
            value: "",
            flag: "0",
          },
        ],
        [
          {
            name: "经营范围",
            value: "",
            flag: "0",
          },
        ],
      ],
      defaultProps: {
        children: "children",
        label: "industryTypeName",
      },
      rules: {
        customerManager:[
          { required: true, message: "请选择客户经理", trigger: ["blur","change"] },
        ],
        detailAddress: [
          { required: true, message: "请输入详细地址", trigger: "blur" },
          {
            min: 10,
            max: 80,
            message: "详细地址长度应在 10 到 80 个字符",
            trigger: "blur",
          },
        ],
        contactName: [
          { required: true, message: "请输入联系人名称", trigger: "blur" },
        ],
        mobilePhone: [
          // { required: true, message: "请输入移动电话号码", trigger: "blur" },
          { validator: validRules.cx_checkMobilePhone, trigger: "blur" }
        ],
        mobilePhone1: [
          {
            message: "移动电话格式不正确",
            pattern: /^[\d]+([\d-+]*)$/,
            trigger: "blur",
          },
        ],
        officePhone: [
          {
            message: "办公电话格式不正确",
            pattern: /^[\d]+([\d-+]*)$/,
            trigger: "blur",
          },
          { min: 6, message: "移动电话长度不能小于6位", trigger: "blur" },
        ],
        idType: [{ validator: validRules.cx_idType, trigger: "change" }],
        idNumber: [{ validator: validRules.cx_checkIdCard, trigger: "blur" }],
        Email: [
          { type: "email", message: "请输入正确的邮箱地址", trigger: "blur" },
        ],
        communicationFix: [
          {
            message: "传真格式不正确",
            pattern: /^[\d]+([\d-+]*)$/,
            trigger: "blur",
          },
          { min: 6, message: "传真长度不能小于6位!", trigger: "blur" },
        ],
        generalTaxpayer: [
          { validator: validRules.cx_generalTaxpayer, trigger: "change" },
        ],
        registrationNumber: [
          { validator: validRules.cx_registrationNumber, trigger: "blur" },
        ],
        provincesTax: [{ required: true, message: "请选择税务登记号所属省份" }],
        registrationContactNumber: [
          {
            validator: validRules.cx_registrationContactNumber,
            trigger: "blur",
          },
        ],
        taxBankName: [
          { validator: validRules.cx_taxBankName, trigger: "blur" },
        ],
        taxBankAccount: [
          { validator: validRules.cx_taxBankAccount, trigger: "blur" },
        ],
        whetherValueAddedInvoice: [
          { validator: validRules.cx_addInvoice, trigger: "change" },
        ],
        taxRegisteredAddress: [{ validator: validRules.cx_taxAddress }],
        submissionTaxAuditData: [
          { validator: validRules.cx_submitTaxAuditData },
        ],
        reviewStatus: [
          { validator: validRules.cx_reviewStatus, trigger: "change" },
        ],
        taxApprovalDate: [
          { validator: validRules.cx_taxApprovalDate, trigger: "blur" },
        ],
        phoneNumberNotification: [
          { validator: validRules.cx_phoneNumber, trigger: "blur" },
        ],
        notificationEmailNbr: [
          { type: "email", message: "请输入正确的邮箱地址", trigger: "blur" },
        ],
        ticketsWay: [
          { validator: validRules.cx_ticketsWay, trigger: "change" },
        ],
        mailAddress: [
          { validator: validRules.cx_mailAddress, trigger: "blur" },
        ],
        zipCode: [{ validator: validRules.cx_zipCode, trigger: "blur" }],
        agentName:[
           {validator: validRules.cx_edit_certificationPersion, trigger: "blur" }
        ],
        agentIdType:[
           { validator: validRules.cx_edit_idType, trigger: "change" },
        ],
        agentCardNumber:[
           {validator: validRules.cx_edit_idNumber, trigger: "blur" }
        ],
        agentCardAddress:[
          {validator: validRules.cx_edit_idAddress, trigger: "blur" }
        ]
      },
      contactRules:{
        contactName: [
          { required: true, message: "请输入联系人名称", trigger: "blur" },
        ],
        mobilePhone: [
          { required: true, message: "请输入移动电话号码", trigger: "blur" },
          {
            message: "移动电话格式不正确",
            pattern: /^[\d]+([\d-+]*)$/,
            trigger: "blur",
          },
          { min: 11, message: "移动电话长度不能小于11位", trigger: "blur" },
        ],
        officePhone: [
          {
            message: "办公电话格式不正确",
            pattern: /^[\d]+([\d-+]*)$/,
            trigger: "blur",
          },
          { min: 6, message: "办公电话长度不能小于6位", trigger: "blur" },
        ],
        eMail:[
          { type: "email", message: "请输入正确的邮箱地址", trigger: "blur" },
        ],
        fax: [
          {
            message: "传真格式不正确",
            pattern: /^[\d]+([\d-+]*)$/,
            trigger: "blur",
          },
          { min: 6, message: "传真长度不能小于6位!", trigger: "blur" },
        ],
      },
      taxStartDate: {
        disabledDate(time) {
          return time.getTime() > Date.now();
        },
      },
      nsrIsShow: false, //纳税人是与否触发显示隐藏的控制按钮
      defaultShowNodes: [], // 这里存放要默认展开的节点 id
      activeName: "baseInfo",
      tabPosition: "left",
      cityName: "客户地址",
      contryName: "总部所在国家",
      address: { county: "26068", provice: "", city: "", area: "" }, //城市
      contryAddress: { county: "" }, //国家
      chooseAddress: {}, //客户地址的对象
      nsrinShow: false, //是否纳税人后三项显示控制
      outerVisible: false, //添加联系人弹窗按钮
      partName: "重点客户测试",
      industryTypeId: "", //行业类型id
      //是否是首选联系人数组
      preferredContactArr: [
        {
          value: "1",
          label: "是",
        },
        {
          value: "2",
          label: "否",
        },
      ],
      // 是否是一般纳税人
      generalTaxpayerArr: [
        {
          value: "1",
          label: "是",
        },
        {
          value: "0",
          label: "否",
        },
      ],
      //是否开增值税发票
      whetherValueAddedInvoiceArr: [
        {
          value: "",
          label: "请选择",
        },
        {
          value: "1",
          label: "是",
        },
        {
          value: "0",
          label: "否",
        },
      ],
      // 审核状态
      reviewStatusArr: [
        { value: "", label: "请选择" },
        { value: "0", label: "未通过" },
        { value: "1", label: "已通过" },
      ],
      // 取票方式Arr
      ticketsWayArr: [
        { value: "", label: "请选择" },
        { value: "1", label: "邮寄" },
        { value: "2", label: "客户自取" },
        { value: "3", label: "上门送票" },
      ],
      //输入框数组
      custFormBaseFormData: {
        // 营销责任地code值
        industryTypeCode: "",
        //客户经理
        customerManager: "",
        //客户经理id
        customerManagerId: "",
        // 客户地址
        custAddress: "",
        //详细地址
        detailAddress: "",
        // 联系人名称
        contactName: "",
        // 移动电话
        mobilePhone: "",
        //移动电话1
        mobilePhone1: "",
        // 办公电话
        officePhone: "",
        // 证件类型
        idType: "",
        //证件号码
        idNumber: "",
        // 联系人信息Email
        Email: "",
        // 通信地址
        communicationAddress: "",
        // 通信邮编
        communicationZipCode: "",
        // 传真
        communicationFix: "",
        // 是否是首选联系人value
        preferredContactValue: '是',
        generalTaxpayer: "否", //是否是纳税人
        //纳税客户名称
        taxpayerName: "张三",
        //税务登记号
        registrationNumber: "",
        //税务登记号所属省份
        provincesTax: "",
        //税务登记联系电话
        registrationContactNumber: "",
        // 证件地址
        idAddress: "",
        // 税务开户行名称
        taxBankName: "",
        // 税务开户行账号
        taxBankAccount: "",
        //税务登记地址
        taxRegisteredAddress: "",
        //是否开增值税发票
        whetherValueAddedInvoice: "",
        // 提交税务审核日期
        submissionTaxAuditData: "",
        //审核状态
        reviewStatus: "",
        // 税务审核通过日期
        taxApprovalDate: "",
        // 通知短信手机号
        phoneNumberNotification: "",
        //通知邮箱号
        notificationEmailNbr: "",
        // 取票方式
        ticketsWay: "",
        //邮寄地址
        mailAddress: "",
        // 邮编
        zipCode: "",
        // 开票点
        makeOutInvoicePlace: "",
        // 客户性质选中值
        custPropertyValue: "",
        // 售后服务等级
        afterSalesServiceLevel: "",
        // 客户服务等级
        custSalesServiceLevel: "",
        // 省行业经理选中值
        proIndustryManagerValue: "",
        //总部所在国家
        headquarterCountry: "",
        //客户类别
        custKind: "",
        // 经办人名称
        agentName: "",
        //企业员工数
        employeesNumber: "",
        // 经办人-证件类型
        agentIdType: "",
        // 证件号码
        agentCardNumber: "",
        // 证件地址
        agentCardAddress: "",
      },
      //联系人form数据
      custContactFormData:{
        contactName:'',
        mobilePhone:'',
        officePhone:'',
        contactCertType:'',
        contactCertNum:'',
        eMail:'',
        contactAddr:'',
        postcode:'',
        fax:'',
      },
      serviceFlag:'否',
      labelPosition: "left",
      //  省市区
      value: [],
      // 客户经理-员工列表-表单双向数据绑定
      employeesListFormData: {
        custCode: "", //员工编码
        custName: "", //员工名称
        orgName: "", //组织名称
      },
      //客户经理-员工列表-表格数据-员工列表
      employeesListTableData: [],
      selectionManner: [], //选中的客户经理
      delselectManner: [], //删除已选中的客户经理
      //客户经理-员工列表-表格数据-员工列表-分页
      employeesListTablePage: {
        pageIndex: 1, //当前页码
        pageSize: 5, //每页多少条
        rowCount: 10, //总条数
        pageCount: 10, //总页数
      },
      // 客户经理已选员工列表
      employeesSelectedListTableData: [],
      // 省行业经理弹窗
      proIndustryManagerFormData: {
        // 员工编码
        custCode: "",
        // 员工姓名
        custName: "",
        // 组织名称
        orgName: "",
        // 手机号码
        mobileNumber: "",
      },
      // 省行业经理-表头
      proIndustryManagerTable: [],
      // 省行业经理--分页
      proIndustryManagerPage: {
        pageIndex: 1,
        pageSize: 5,
        totalResult: 0,
      },
      //省选中的客户经理信息
      chooseProManagerPage: {
        STAFF_ID: "",
        STAFF_NAME: "",
      },
      //更多联系人分页
      custContactTablePage:{
        pageIndex: 1,
        pageSize: 3,
        rowCount: 0,
      },
      //本地选中的客户经理信息
      chooseLocalManagerPage: {
        STAFF_ID: "",
        STAFF_NAME: "",
      },
      //  本地行业经理label位置
      localNetworkManagerFormLabelPosition: "left",
      // 本地行业经理form
      localNetworkManagerFormData: {
        // 员工编码
        custCode: "",
        // 员工姓名
        custName: "",
        // 组织名称
        orgName: "",
        // 手机号码
        mobileNumber: "",
      },
      LocalIndustryManagerPage: {
        pageIndex: 1,
        pageSize: 3,
        totalResult: 0,
      },
      // 行业经理
      localNetworkManageTable: [
        {
          custCode: "员工编码",
          custName: "员工名称",
          organizationName: "组织名称",
          departmentName: "部门名称",
          telNumber: "手机号码",
        },
        {
          custCode: "员工编码",
          custName: "员工名称",
          organizationName: "组织名称",
          departmentName: "部门名称",
          telNumber: "手机号码",
        },
      ],
      // 客户经理表格分页
      querycustManagerIdDialog: {
        pageIndex: 1, //当前页码
        pageSize: 5, //每页多少条
        rowCount: 10, //总条数
        pageCount: 10, //总页数
      },
      //联系人列表
      contactsArr: [],
      selectInfo: [
        {
          flag: "cust_kind", //客户类别
          val: [],
        },
        {
          flag: "enterprise_kind", //客户性质
          val: [],
        },
        {
          flag: "secrecy_level", //售后服务等级
          val: [],
        },
        {
          flag: "service_level", //客户服务等级
          val: [],
        },
        {
          flag: "cert_type_s", //证件类型（修改客户、新建客户填报）
          val: [],
        },
        {
          flag: "cert_type_l", //证件类型（新建客户填报联系人证件类型）
          val: [],
        },
        {
          flag: "tax_province_code", //省列表
          val: [],
        },
      ],
      showManerP: false,
      showManerL: false,
      editFlag:false,//添加联系人是否修改标识
      contactIndex:'',//暂存修改联系人的index
      nsrDisabeld:false,//纳税人所属省份禁用键
      phoneBool:true,
    };
  },
  components: {
    MorePanel,
    DicCustomerSelect,
    loadCity,
    ContryOrProvice,
  },
  created() {},
  computed: {
    ...mapState("user", ["user"]),
  },
  mounted() {
    this.$nextTick(() => {
      this.initGetPartyNews();
      this.initSelect();
      this.getManagerList();
      this.checkManager()
    });
  },
  methods: {
    // 初始化信息接口
    async initGetPartyNews() {
      let params = {
        partyId: this.$route.query.partyId,
        staffId: this.$route.query.staffId,
      };
      const response = await CustomerInfoManageServer.initGetPartyNews(params);
      if (response.code == 200) {
        let result = response.meta;
        
        this.getPhoto(result.party.partyCert.photoPath)
        this.partName = this.isNull(result.party.partyName);
        this.industryTypeId = this.isNull(result.party.partyOrg.industryTypeId);
        // 统一社会信用代码
        this.dataArr[0][0].value = this.isNull(result.party.partyCert.orgUscc);
        // 证件类型
        this.dataArr[0][1].value = this.isNull(
          result.party.partyCert.certTypeName
        );
        //  证件号码
        this.dataArr[0][2].value = this.isNull(result.party.partyCert.certNum);
        // 身份证类型
        this.dataArr[0][3].value = this.isNull(result.party.identityTypeName);
        // 身份证编码
        this.dataArr[0][4].value = this.isNull(result.party.partyNbr);
        // 身份证有效期
        this.dataArr[0][5].value = this.format(
          this.isNull(result.party.idExpDate)
        );
        // 客户简称
        this.dataArr[0][6].value = this.isNull(result.party.partyAbbrname);
        // 机构类型
        this.dataArr[0][7].value = this.isNull(
          result.party.partyOrg.orgPropertyName
        );
        // 行业类型
        this.dataArr[0][8].value = this.isNull(
          result.party.partyOrg.industryName
        );
        // 登记管理部门名称
        this.dataArr[1][0].value = this.isNull(
          result.party.partyOrg.registerOrg
        );
        // 经济类型
        this.dataArr[1][2].value = this.isNull(
          result.party.partyOrg.econTypeName
        );
        //法定代表人姓名
        this.dataArr[1][3].value = this.isNull(result.party.partyOrg.legalRepr);
        //注册资本
        this.dataArr[1][4].value = this.isNull(result.party.partyOrg.orgAssets);
        //成立日期
        this.dataArr[1][5].value = this.format(
          this.isNull(result.party.partyOrg.custBuildDate)
        );
        //发照日期
        this.dataArr[1][6].value = this.format(
          this.isNull(result.party.partyCert.issuedate)
        );
        //经营状态
        this.dataArr[1][7].value = this.isNull(
          result.party.partyOrg.busiStatusCdName
        );
        //发证机关
        this.dataArr[1][8].value = this.isNull(result.party.partyOrg.certorg);
        //生产经营地址
        this.dataArr[1][9].value = this.isNull(result.party.partyOrg.orgAddr);
        //注册地址
        this.dataArr[1][10].value = this.isNull(
          result.party.partyOrg.registerAddr
        );
        this.custFormBaseFormData.detailAddress = this.isNull(result.party.partyOrg.registerAddr);
        //经营范围
        this.dataArr[2][0].value = this.isNull(result.party.partyOrg.busiScope);
        if(this.dataArr[0][0].value != ''){
          this.custFormBaseFormData.registrationNumber = this.dataArr[0][0].value
          this.registration()
        }
        if(result.party.partyCert.certType == '72'){
           this.rules.provincesTax[0].required = false;
           this.phoneBool = false;
        }
      }
    },
    //获取证件照片
    async getPhoto(path){
      if(path){
        const response = await CustomerInfoManageServer.getCustPhoto({photoPath:path});
        if(response.code == 200){
           this.src = response.meta.base64
        }
      }else {
        this.src = ''
      }
    },
    registration(){
      let proN = ''
      if(this.custFormBaseFormData.registrationNumber.length == 18){
          proN = this.custFormBaseFormData.registrationNumber.substring(2,4)
      }else if (this.custFormBaseFormData.registrationNumber.length == 15 || this.custFormBaseFormData.registrationNumber.length == 20){
          proN = this.custFormBaseFormData.registrationNumber.substring(0,2)
      }
      switch (proN){
        case '11':
          this.custFormBaseFormData.provincesTax = '8110100'
          this.nsrDisabeld = true;
          break;
        case '12':
          this.custFormBaseFormData.provincesTax = '8120000'
          this.nsrDisabeld = true;
          break;
        case '13':
          this.custFormBaseFormData.provincesTax = '8130000'
          this.nsrDisabeld = true;
          break;
        case '14':
          this.custFormBaseFormData.provincesTax = '8140000'
          this.nsrDisabeld = true;
          break;
        case '15':
          this.custFormBaseFormData.provincesTax = '8150000'
          this.nsrDisabeld = true;
          break;
        case '21':
          this.custFormBaseFormData.provincesTax = '8210000'
          this.nsrDisabeld = true;
          break;
        case '22':
          this.custFormBaseFormData.provincesTax = '8220000'
          this.nsrDisabeld = true;
          break;
        case '23':
          this.custFormBaseFormData.provincesTax = '8230000'
          this.nsrDisabeld = true;
          break;
        case '31':
          this.custFormBaseFormData.provincesTax = '8310100'
          this.nsrDisabeld = true;
          break;
        case '32':
          this.custFormBaseFormData.provincesTax = '8320000'
          this.nsrDisabeld = true;
          break;
        case '33':
          this.custFormBaseFormData.provincesTax = '8330000'
          this.nsrDisabeld = true;
          break; 
        case '34':
          this.custFormBaseFormData.provincesTax = '8340000'
          this.nsrDisabeld = true;
          break;  
        case '35':
          this.custFormBaseFormData.provincesTax = '8350000'
          this.nsrDisabeld = true;
          break;   
        case '36':
          this.custFormBaseFormData.provincesTax = '8360000'
          this.nsrDisabeld = true;
          break;
        case '37':
          this.custFormBaseFormData.provincesTax = '8370000'
          this.nsrDisabeld = true;
          break;
        case '41':
          this.custFormBaseFormData.provincesTax = '8410000'
          this.nsrDisabeld = true;
          break;
        case '42':
          this.custFormBaseFormData.provincesTax = '8420000'
          this.nsrDisabeld = true;
          break;
        case '43':
          this.custFormBaseFormData.provincesTax = '8430000'
          this.nsrDisabeld = true;
          break;
        case '44':
          this.custFormBaseFormData.provincesTax = '8440000'
          this.nsrDisabeld = true;
          break;
        case '45':
          this.custFormBaseFormData.provincesTax = '8450000'
          this.nsrDisabeld = true;
          break;
        case '46':
          this.custFormBaseFormData.provincesTax = '8460000'
          this.nsrDisabeld = true;
          break;
        case '50':
          this.custFormBaseFormData.provincesTax = '8500000'
          this.nsrDisabeld = true;
          break;
        case '51':
          this.custFormBaseFormData.provincesTax = '8510000'
          this.nsrDisabeld = true;
          break;
        case '52':
          this.custFormBaseFormData.provincesTax = '8520000'
          this.nsrDisabeld = true;
          break;
        case '53':
          this.custFormBaseFormData.provincesTax = '8530000'
          this.nsrDisabeld = true;
          break;
        case '54':
          this.custFormBaseFormData.provincesTax = '8540000'
          this.nsrDisabeld = true;
          break;
        case '61':
          this.custFormBaseFormData.provincesTax = '8610000'
          this.nsrDisabeld = true;
          break;
        case '62':
          this.custFormBaseFormData.provincesTax = '8620000'
          this.nsrDisabeld = true;
          break;
        case '63':
          this.custFormBaseFormData.provincesTax = '8630000'
          this.nsrDisabeld = true;
          break;
        case '64':
          this.custFormBaseFormData.provincesTax = '8640000'
          this.nsrDisabeld = true;
          break;
        case '65':
          this.custFormBaseFormData.provincesTax = '8650000'
          this.nsrDisabeld = true;
          break;
        default:
          this.custFormBaseFormData.provincesTax = ""
          this.nsrDisabeld = false;
          this.$nextTick(()=>{
            this.$refs.custFormBaseFormData.clearValidate('provincesTax');
          })
          break;
      }
    },
    //初始化下拉框
    initSelect() {
      let response = "";
      this.selectInfo.forEach(async (item, index) => {
        response = await CustomerInfoManageServer.initValue({
          flag: item.flag,
        });
        if (response.code == 200) {
          this.selectInfo[index].val = response.meta.customers;
        }
      });
      
    },
    async getManagerList() {
      const response = await CustomerInfoManageServer.getManagerList({
        pageIndex: 1,
        pageSize: 5,
        STAFF_CODE: this.employeesListFormData.custCode,
        STAFF_NAME: this.employeesListFormData.custName,
        ORG_NAME: this.employeesListFormData.orgName,
        ORG_ID:this.user.orgId
      });
      if (response.code == 200) {
        this.employeesListTablePage.rowCount = response.meta.pageInfo.rowCount;
        this.employeesListTableData = response.meta.customers;
      }
    },
    //查询客户经理用于初始化显示
    async checkManager() {
      let response = await CustomerInfoManageServer.getStaffList({
        STAFF_ID: this.user.staffId,
      });
      // let manner =  [
      //       {
      //           "DEPARTMENT_NAME":"集团公司",
      //           "ORG_ID":1944640,
      //           "DEPARTMENT_ID":1944640,
      //           "ORG_NAME":"集团公司",
      //           "STAFF_ID":1,
      //           "STAFF_NAME":"系统管理员",
      //           "STAFF_CODE":"admin"
      //       }
      //   ]
      if (response.code == 200) {
        // if(response.meta.customers.length == 0){
        //   this.selectionManner = manner;
        //   this.employeesSelectedListTableData = manner;
        //   this.custFormBaseFormData.customerManager = manner[0].STAFF_NAME
        //   this.custFormBaseFormData.customerManagerId = manner[0].STAFF_ID
        // }else {
          this.selectionManner = response.meta.customers;
          this.employeesSelectedListTableData = response.meta.customers;
          this.custFormBaseFormData.customerManager = response.meta.customers[0].STAFF_NAME
          this.custFormBaseFormData.customerManagerId = response.meta.customers[0].STAFF_ID
        // }
      }
    },
    // //   行业类型弹窗
    // handleTree(data) {
    //   
    //   // 
    //   this.custFormBaseFormData.industryCd = data.industryTypeName;
    //   // 获取行业类型的code
    //   this.custFormBaseFormData.industryTypeCode = data.industryTypeId;

    //   this.$refs.industryCdRef[0].drawer = false;
    // },
    // 客户类别下拉框选择方法
    custTypeHandel() {
      
    },
    //
    handleChange(value) {
      
    },
    // 省行业经理弹窗数据交互
    proIndustryManagerAjax() {},

    // 行业类型
    industryCdAjax() {
      
    },
    // 本地行业经理
    handleSizeChange() {},
    handleCurrentChange(val) {
      this.LocalIndustryManagerPage.pageIndex = val;
      this.employeesListQuery(3, "change");
    },
    // 省行业经理
    proHandleCurrentChange(val) {
      this.proIndustryManagerPage.pageIndex = val;
      this.employeesListQuery(2, "change");
    },
    //省行业经理点击行
    proIndustryManagerDialogRow(val) {
      
      this.chooseProManagerPage = val;
      this.$refs.dicCustomerSelect.drawer = false;
    },
    // 客户经理ajax初始化
    customerManagerAjax() {},
    // 客户经理 -选择方法
    chooseHandel() {
      if (
        this.selectionManner.length +
          this.employeesSelectedListTableData.length >
        2
      ) {
        this.$alert("客户经理最多只能选择2个", "提示", { type: "warning" });
      } else {
        if (this.employeesSelectedListTableData.length == 0) {
          this.selectionManner.forEach((el,index) => {
            if(index == 0){
              this.employeesSelectedListTableData.push(el);
            }else {
              if(this.employeesSelectedListTableData[0].ORG_ID == el.ORG_ID){
                 this.employeesSelectedListTableData.push(el);
              }else {
                this.employeesSelectedListTableData = [];
                this.$alert('客户经理必须为同一组织', "提示", {
                    type: "warning",
                  });

              }
            }
          });
        } else {
          this.employeesSelectedListTableData.forEach((item) => {
            if (item.STAFF_ID == this.selectionManner[0].STAFF_ID) {
              this.$alert(`${item.STAFF_NAME}已被添加，不能重复添加`, "提示", {
                type: "warning",
              });
            }else if(item.ORG_ID != this.selectionManner[0].ORG_ID){
                this.$alert('客户经理必须为同一组织', "提示", {
                  type: "warning",
                });
            } else {
              this.selectionManner.forEach((el) => {
                this.employeesSelectedListTableData.push(el);
              });
            }
          });
        }
      }
    },
    // 客户经理-查询方法
    async employeesListQuery(val, type) {
      let params;
      if (val == 1) {
        params = {
          pageIndex:
            type == "change" ? this.employeesListTablePage.pageIndex : 1,
          pageSize: "5",
          STAFF_CODE: this.employeesListFormData.custCode,
          STAFF_NAME: this.employeesListFormData.custName,
          ORG_NAME: this.employeesListFormData.orgName,
          ORG_ID:this.user.orgId
        };
      } else if (val == 2) {
        params = {
          pageIndex:
            type == "change" ? this.proIndustryManagerPage.pageIndex : 1,
          pageSize: "5",
          STAFF_CODE: this.proIndustryManagerFormData.custCode,
          STAFF_NAME: this.proIndustryManagerFormData.custName,
          ORG_NAME: this.proIndustryManagerFormData.orgName,
          ORG_ID:this.user.orgId,
          flag:1
        };
      } else if (val == 3) {
        params = {
          pageIndex:
            type == "change" ? this.LocalIndustryManagerPage.pageIndex : 1,
          pageSize: "5",
          STAFF_CODE: this.localNetworkManagerFormData.custCode,
          STAFF_NAME: this.localNetworkManagerFormData.custName,
          ORG_NAME: this.localNetworkManagerFormData.orgName,
          ORG_ID:this.user.orgId,
          flag:1
        };
      }
      const response = await CustomerInfoManageServer.getManagerList(params);
      if (response.code == 200) {
        if (val == 1) {
          this.employeesListTablePage.pageIndex =
            type == "change" ? this.employeesListTablePage.pageIndex : 1;
          this.employeesListTableData = response.meta.customers;
          this.employeesListTablePage.rowCount = response.meta.pageInfo.rowCount;
        } else if (val == 2) {
          this.showManerP = true;
          this.proIndustryManagerPage.pageIndex =
            type == "change" ? this.proIndustryManagerPage.pageIndex : 1;
          this.proIndustryManagerPage.rowCount =
            response.meta.pageInfo.rowCount;
          this.proIndustryManagerTable = response.meta.customers;
        } else if (val == 3) {
          this.showManerL = true;
          this.LocalIndustryManagerPage.pageIndex =
            type == "change" ? this.LocalIndustryManagerPage.pageIndex : 1;
          this.LocalIndustryManagerPage.rowCount =
            response.meta.pageInfo.rowCount;
          this.localNetworkManageTable = response.meta.customers;
        }
      }
    },
    // 客户经理-员工列表-分页方法
    employeesListTablePageHandleSizeChange(val) {
      
    },
    // 客户经理-员工列表-当前页
    employeesListTablePageHandleCurrentChange(val) {
      this.employeesListTablePage.pageIndex = val;
      this.employeesListQuery(1, "change");
    },
    // 客户经理-员工列表-点击复选框触发的事件
    handleSelectionChange(val) {
      this.selectionManner = val;
    },
    // 客户经理-已选员工列表-点击复选框触发的事件
    employeesSelectedListHandleSelectionChange(val) {
      // 
      this.delselectManner = val;
      
    },
    //删除客户经理
    delManner() {
      if (this.delselectManner.length == 2) {
        this.employeesSelectedListTableData = [];
      } else {
        this.employeesSelectedListTableData.forEach((item, index) => {
          this.delselectManner.forEach((item1) => {
            if (item.STAFF_ID == item1.STAFF_ID) {
              this.employeesSelectedListTableData.splice(index, 1);
            }
          });
        });
      }
    },
    closeDialog() {
      this.custFormBaseFormData.customerManager = "";
      this.custFormBaseFormData.customerManagerId = "";
      this.employeesSelectedListTableData.forEach((item, index) => {
        this.custFormBaseFormData.customerManager =
          index == 0 && this.employeesSelectedListTableData.length == 2
            ? this.custFormBaseFormData.customerManager +
              item.STAFF_NAME +
              ";"
            : this.custFormBaseFormData.customerManager + item.STAFF_NAME;
        this.custFormBaseFormData.customerManagerId =
          index == 0 && this.employeesSelectedListTableData.length == 2
            ? this.custFormBaseFormData.customerManagerId +
              item.STAFF_ID +
              ";"
            : this.custFormBaseFormData.customerManagerId + item.STAFF_ID;
      });
    },
    // 本地行业经理
    // 本地行业经理ajax
    localNetworkManagerAjax() {},
    // 本地行业经理查询
    localNetworkManagerQuery() {
      
    },
    //本地行业经理选中
    localNetworkManagerDialogRow(val) {
      this.chooseLocalManagerPage = val;
      this.$refs.localNetworkManager.drawer = false;
    },
    //改变证件类型移除证件号码校验结果
    changeType() {
      this.$refs.custFormBaseFormData.clearValidate("idNumber");
    },
    //纳税人选择事件
    nsrSelectChange(val) {
      val == "是" ? (this.nsrIsShow = true) : (this.nsrIsShow = false);
      val == "是" ? (this.nsrinShow = true) : (this.nsrinShow = false);
      this.$refs.MorePanel.setVisible(this.nsrIsShow);
      this.$refs.custFormBaseFormData.clearValidate(["registrationNumber"]);
    },
    //改变纳税人模块显示状态
    changeShow(val) {
      this.nsrIsShow = val;
    },
    getAddress(val) {
      
      this.chooseAddress = val;
    },
    getcontry(val) {
      
      this.custFormBaseFormData.headquarterCountry = val.county;
    },
    //提交客户信息接口
    comitBtn() {
      this.$refs.custFormBaseFormData.validate((valid) => {
        if (valid) {
          this.saveCustNews();
        } else {
          return false;
        }
      });
    },
    async saveCustNews() {
      let contactsInfo = Object.assign([],this.contactsArr);
      contactsInfo.forEach(item=>{
        item.headFlag = 2
        this.selectInfo[5].val.forEach(i=>{
          if(i.name == item.contactCertType){
            item.contactCertType = i.code
          }
        })
      })
      contactsInfo.push(
        {
          contactName: this.custFormBaseFormData.contactName, //联系人名称
          mobilePhone: this.custFormBaseFormData.mobilePhone ? this.custFormBaseFormData.mobilePhone : this.custFormBaseFormData.mobilePhone1, //移动电话
          officePhone: this.custFormBaseFormData.officePhone, //办公电话
          contactCertType: this.custFormBaseFormData.idType, //证件类型
          contactCertNum: this.custFormBaseFormData.idNumber, //证件号码
          eMail: this.custFormBaseFormData.Email, //Email
          contactAddr: this.custFormBaseFormData.communicationAddress, //通信地址
          postcode: this.custFormBaseFormData.communicationZipCode, //通信邮编
          fax: this.custFormBaseFormData.communicationFix, //传真
          headFlag:1, //是否首选联系人   1:是  2：否
        })
      let params = {
        //后台需要的前页传的信息
        partyId: this.$route.query.partyId, //参与人主键
        custName: this.partName, //证件名称
        ifABCust:this.$route.query.type == 'customerAdd'? undefined:1,//争议单完善信息标识
        custId:this.$route.query.type == 'customerAdd' ? undefined:this.$route.query.custId,//争议单完善信息
        // certType:'1',//证件类型
        // certNum:'110101198001010117',//证件号码
        staffId: this.$route.query.staffId, //用户id
        partyNbr: this.$route.query.partyNbr, //身份证编码
        auditor:this.$route.query.custflag,//审核人
        //客户基本信息
        commonRegionId: this.$route.query.commonRegionId, //营销责任地编码
        // regionName:this.custFormBaseFormData.industryTypeCode,//营销责任地名称
        // custManageIdAB: this.$route.query.staffId, //客户经理
        custManageIdAB:this.custFormBaseFormData.customerManagerId,//客户经理
        // custManageIdABNmae:'系统管理员',//客户经理名称
        industryCd: this.industryTypeId, //行业类型
        // industryCdName:'1',//行业类型名称
        country: this.chooseAddress.county, // 国家
        province: this.chooseAddress.provice, //省
        city: this.chooseAddress.city ? this.chooseAddress.city : "", //城市
        county: this.chooseAddress.area ? this.chooseAddress.area : "", //区县
        custAddr: this.custFormBaseFormData.detailAddress, //客户地址
        //客户联系人信息
        // contactName: this.custFormBaseFormData.contactName, //联系人名称
        // mobilePhone: this.custFormBaseFormData.mobilePhone, //移动电话
        // officePhone: this.custFormBaseFormData.officePhone, //办公电话
        // contactCertType: this.custFormBaseFormData.idType, //证件类型
        // contactCertNum: this.custFormBaseFormData.idNumber, //证件号码
        // eMail: this.custFormBaseFormData.Email, //Email
        // postAddr: this.custFormBaseFormData.communicationAddress, //通信地址
        // postCode: this.custFormBaseFormData.communicationZipCode, //通信邮编
        // fax: this.custFormBaseFormData.communicationFix, //传真
        // headFlag:1, //是否首选联系人   1:是  2：否
        contactsInfo:contactsInfo,//客户联系人列表
        //纳税人信息
        generalTaxpayerFlag:
          this.custFormBaseFormData.generalTaxpayer == "是" ? "1" : "0", //是否一般纳税人  1:是  0：否
        taxName: this.partName, //纳税客户名称
        taxId: this.custFormBaseFormData.registrationNumber, //税务登记号
        taxProvinceCode: this.custFormBaseFormData.provincesTax, //税务登记号所属省份
        taxRelaTel: this.custFormBaseFormData.registrationContactNumber, //税务登记联系电话
        taxBankName: this.custFormBaseFormData.taxBankName, //税务开户银行名称
        taxBankAcct: this.custFormBaseFormData.taxBankAccount, //税务开户银行帐号
        taxRelaAddr: this.custFormBaseFormData.taxRegisteredAddress, //税务登记地址
        vatInvoicesFlag: this.custFormBaseFormData.whetherValueAddedInvoice, //是否开增值税发票
        submitDate: this.custFormBaseFormData.submissionTaxAuditData, //提交税务审核日期
        audState: this.custFormBaseFormData.reviewStatus, //审核状态
        // controlType: "13013005",
        approvalTime: this.custFormBaseFormData.taxApprovalDate, //税务审核通过日期
        receiveMsgNum: this.custFormBaseFormData.phoneNumberNotification, //通知短信手机号
        receiveEmail: this.custFormBaseFormData.notificationEmailNbr, //通知邮箱号
        takeType: this.custFormBaseFormData.ticketsWay, //取票方式
        billDeliverAddr: this.custFormBaseFormData.mailAddress, //邮寄地址
        taxPostCode: this.custFormBaseFormData.zipCode, //邮编
        invoiceAddr: this.custFormBaseFormData.makeOutInvoicePlace, //开票点
        //其他补充信息
        enterpriseKind: this.custFormBaseFormData.custPropertyValue, //客户性质
        serviceLevel: this.custFormBaseFormData.custSalesServiceLevel, //客户服务等级
        secrecyLevel: this.custFormBaseFormData.afterSalesServiceLevel, //售后服务等级
        custManageIdS: this.chooseProManagerPage.STAFF_ID, //省行业经理
        // custManageIdSName:'范德萨发的',//省行业经理名称
        headCountry: this.custFormBaseFormData.headquarterCountry, //总部所在国家
        // serviceLevelCd: "2100",
        personNum: this.custFormBaseFormData.employeesNumber, //企业员工数
        custManageIdD: this.chooseLocalManagerPage.STAFF_ID, //本地网行业经理
        // custManageIdDName:'佛挡杀佛',//本地网行业经理名称
        custKind: this.custFormBaseFormData.custKind, //客户类别
        certificationPersion: this.custFormBaseFormData.agentName, //经办人名称
        certificationType: this.custFormBaseFormData.agentIdType, //证件类型
        certificationNumber: this.custFormBaseFormData.agentCardNumber, //证件号码
        certificationAddress: this.custFormBaseFormData.agentCardAddress, //证件地址
      };
      let loadingInstance = this.$loading({ fullscreen: true });
      let response = await CustomerInfoManageServer.saveCustNews(params);
      loadingInstance.close();
      if (response.code == 200) {
        this.$confirm("信息保存成功", "提示", {
          confirmButtonText: "确定",
          showCancelButton: false,
          type: "success",
          center: true,
        })
          .then(() => {
            if(this.$route.query.type == 'customerAdd'){
              this.$router.push({
                path: "/custbaseinf",
                query: {
                  // partyId: "2102",
                  // staffId: "100078",
                  // type: "customerAdd",
                },
              });
            }else {
              this.$router.push({
                path: "/abCustManage",
                query: {
                  // partyId: "2102",
                  // staffId: "100078",
                  // type: "customerAdd",
                },
              });
            }
          })
          .catch(() => {});
      }
    },
    //取消按钮返回上一页
    cancelBtn() {
      this.$router.push({
        path: "/custbaseinf",
        query: {
          // partyId: "2102",
          // staffId: "100078",
          // type: "customerAdd",
        },
      });
    },
    // 判断值是否存在
    isNull(val) {
      if (
        val == "NaN" ||
        val == "null" ||
        val == "undefined" ||
        val == undefined
      ) {
        return (val = "");
      } else {
        return val;
      }
    },
    format(val) {
      if (val) {
        var y = val.substring(0, 4);
        var m = val.substring(4, 6);
        var d = val.substring(6, 8);
        return y + "-" + m + "-" + d;
      } else {
        return val;
      }
    },
    visible() {
      this.editFlag = false;
      this.outerVisible = true;
      // this.getContInfoList(1)
    },
    //更多联系人分页
    custContactHandleCurrentChange(val){
      this.custContactTablePage.pageIndex = val;
    },
    // async getContInfoList(val){
    //   let params = {
    //     partyId: this.$route.query.partyId,
    //     statusCdList: "1000",
    //     pageIndex:val,
    //     pageSize:3
    //   };
    //   // const response = await CustomerInfoManageServer.getContInfoList(params);
    //   // if(response.code == 200) {
    //   //     this.contactsArr = response.meta.executeSqlResp;
    //   //     this.custContactTablePage.rowCount = response.meta.pageInfo.rowCount;
    //   //     this.contactsArr.forEach(item => {
    //   //       item.headFlag = item.headFlag == 1 ? '是' : '否'
    //   //     })
    //   // }
    // },
    //更多联系人修改操作
    handleClick(val,index){
      this.editFlag = true;
      this.selectInfo[5].val.forEach(item=>{
        if(item.name == this.custContactFormData.contactCertType){
          val.contactCertType = item.code
        }
      })
      this.custContactFormData = Object.assign({},val)
      this.contactIndex = index;
    },
    //更多联系人删除操作
    delClick(index, rows){
      this.$confirm("确认删除该联系人吗？", "提示", {
        confirmButtonText: "确定",
        type: "warning",
        cancelButtonText: "取消",
      })
        .then(() => {
           rows.splice(index, 1);
        })
        .catch(() => {});
    },
    //更多联系人添加保存按钮
    async custContactSave(){
      this.$refs.custContactFormData.validate((valid) => {
        if (valid) {
          if(this.editFlag){
            this.updateContInfo();
          }else {
            this.saveCustContact();
          }
        } else {
          return false;
        }
      });

    },
    //添加联系人接口
    saveCustContact (){
      let contactCertType = '';
      this.selectInfo[5].val.forEach(item=>{
        if(item.code == this.custContactFormData.contactCertType){
           contactCertType = item.name
        }
      })
      let contactsInfo ={
         contactName:this.custContactFormData.contactName,
         mobilePhone:this.custContactFormData.mobilePhone,
         officePhone:this.custContactFormData.officePhone,
         contactCertType:contactCertType,
         contactCertNum:this.custContactFormData.contactCertNum,
         eMail:this.custContactFormData.eMail,
         contactAddr:this.custContactFormData.contactAddr,
         postcode:this.custContactFormData.postcode,
         fax:this.custContactFormData.fax,
         headFlag:'否',
      }
      this.contactsArr.push(contactsInfo);
      this.outerVisible = false;
      // const response = await CustomerInfoManageServer.saveContInfo(parmas);
      // if(response.code == 200){
      //    if(response.meta.resultCode == 0){
      //     this.outerVisible = false;
      //   }else {
      //     this.$message({
      //       showClose: true,
      //       message: response.meta.resultMsg,
      //       type: 'error'
      //     });
      //   }
      // }
    },
    //修改现有联系人接口
    updateContInfo (){
      let contactCertType = '';
      this.selectInfo[5].val.forEach(item=>{
        if(item.code == this.custContactFormData.contactCertType){
           contactCertType = item.name
        }
      })
      let contactInfo = {
         contactName:this.custContactFormData.contactName,
         mobilePhone:this.custContactFormData.mobilePhone,
         officePhone:this.custContactFormData.officePhone,
         contactCertType:contactCertType,
         contactCertNum:this.custContactFormData.contactCertNum,
         eMail:this.custContactFormData.eMail,
         contactAddr:this.custContactFormData.contactAddr,
         postcode:this.custContactFormData.postcode,
         fax:this.custContactFormData.fax,
         headFlag:'否',
      }
      this.contactsArr[this.contactIndex] = contactInfo;
      this.outerVisible = false;
    },
    //更多联系人关闭弹窗
    closeShow() {
      this.outerVisible = false;
      this.$nextTick(() => {
          this.$refs.custContactFormData.resetFields();
      });
    },
  },
};
</script>
<style lang="scss" scoped>
// .title-left{
//    span{
//     font-size:$fontSize_v2;
//     font-weight: 600;
//     position: relative;
//     color:$textColor1;
//     padding-left: .08rem;
//     &::before{
//       content: '';
//       border-left: .03rem solid #f56d39;
//       display: inline-block;
//       position: absolute;
//       left: 0;
//       top:9%;
//       height: 78%;
//     }
//    }
//  }
.button-sx-f {
  width: 100%;
  margin: 0 auto;
  text-align: center;
  background-color: rgba(255, 255, 255, 1);
  padding: 0 0 0px 0;
  position: fixed;
  bottom: 0rem;
  padding-top: 0.15rem;
  padding-bottom: 0.15rem;
  left: 0;
  right: 0;
  box-shadow: 0px 10px 14px 10px rgba(0, 0, 0, 0.1);
}
.el-form-item {
  margin-bottom: 0.2rem;
}

.cust-base-info {
  background: #fff;
  padding: 10px 20px;
}

.form-block {
  margin-top: 0 !important;
}

.m-cascader {
  width: 100%;
}

.m-title {
  // margin-bottom: 10px;
  height: 0.4rem;
  line-height: 0.4rem;
  color: #0052d9;
  font-size: 12px;
}
.m-title button {
  float: right;
  margin-right: 20px;
  height: 0.2rem;
}

.m-box {
  background-color: rgba(221, 221, 221, 0.2);
  padding: 13px;
  margin-top: 20px;
  text-align: center;
  font-size: 14px;
}

.m-title .icon {
  float: left;
  display: block;
  width: 4px;
  height: 12px;
  background: #f56f3c;
  margin-top: 0.12rem;
  margin-right: 0.1rem;
  font-size: 0.14rem;
}

.img {
  height: 200px;
}

.u-name {
  text-align: right;
  font-size: 13px;
  color: #999;
  padding: 5px 0;
  line-height: 0.4rem;
}
.xxAdress {
  margin-top: 5px;
}
.radioBtn > ::v-deep .el-radio-button__inner {
  // padding: 0 .5rem;
  width: 1rem;
}
.radioBtn:first-child > ::v-deep .el-radio-button__inner {
  margin-left: 0;
  margin-right: 0.05rem;
}
.u-value {
  text-align: left;
  font-size: 13px;
  color: #333;
  padding: 5px 0;
  line-height: 0.4rem;
}

.contain {
  background: #fff;
  color: #333;
}

.u-title {
  font-size: 0.18rem;
  color: #333;
  margin-left: 30px;
  margin-bottom: 10px;
  font-weight: 600;
}
.delet-manner {
  float: right;
  width: 0.5rem;
  height: 0.3rem;
  line-height: 0.3rem;
  text-align: center;
  margin-right: 20px;
  background: #0052d9;
  color: #fff;
  border-radius: 0.04rem;
}

.m-contain {
  margin: 20px 0 !important;
}
.m-contain-l {
  margin: 20px 0 10px !important;
}
.other-info {
  margin-bottom: 0.6rem;
}
.base-title {
  font-size: 0.18rem !important;
  line-height: 0.5rem;
  text-align: left;
  font-weight: bold;
}

.m-select {
  width: 100%;
}

.select {
  margin-right: 10px;
}
.table-box {
  margin-bottom: 0.2rem;
}
.el-dialog__body {
  margin-top: 0;
}
.m-tree-box {
  min-height: 4rem;
  overflow-y: auto;
}
.m-box {
  margin: 0.2rem 0;
}
.comit_Btn {
  width: 60px;
  margin-right: 10px;
  text-align: center;
}
.cancel_Btn {
  width: 60px;
  text-align: center;
}
.m-pagination {
  margin-top: 10px;
  text-align: right;
}
.editBtn {
  padding: 0;
}
.delBtn {
  padding: 0;
}
.checkMan {
  text-align: center;
  color: red;
  font-size: 20px;
}
</style>
